Integrand size = 31, antiderivative size = 91 \[ \int (a+a \cos (c+d x)) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {1}{2} a (2 A+B+C) x+\frac {a (3 A+3 B+C) \sin (c+d x)}{3 d}+\frac {a (3 B-C) \cos (c+d x) \sin (c+d x)}{6 d}+\frac {C (a+a \cos (c+d x))^2 \sin (c+d x)}{3 a d} \]
1/2*a*(2*A+B+C)*x+1/3*a*(3*A+3*B+C)*sin(d*x+c)/d+1/6*a*(3*B-C)*cos(d*x+c)* sin(d*x+c)/d+1/3*C*(a+a*cos(d*x+c))^2*sin(d*x+c)/a/d
Time = 0.63 (sec) , antiderivative size = 65, normalized size of antiderivative = 0.71 \[ \int (a+a \cos (c+d x)) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {a (12 A d x+6 B d x+6 C d x+3 (4 A+4 B+3 C) \sin (c+d x)+3 (B+C) \sin (2 (c+d x))+C \sin (3 (c+d x)))}{12 d} \]
(a*(12*A*d*x + 6*B*d*x + 6*C*d*x + 3*(4*A + 4*B + 3*C)*Sin[c + d*x] + 3*(B + C)*Sin[2*(c + d*x)] + C*Sin[3*(c + d*x)]))/(12*d)
Time = 0.37 (sec) , antiderivative size = 102, normalized size of antiderivative = 1.12, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.129, Rules used = {3042, 3502, 3042, 3213}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int (a \cos (c+d x)+a) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \left (a \sin \left (c+d x+\frac {\pi }{2}\right )+a\right ) \left (A+B \sin \left (c+d x+\frac {\pi }{2}\right )+C \sin \left (c+d x+\frac {\pi }{2}\right )^2\right )dx\) |
\(\Big \downarrow \) 3502 |
\(\displaystyle \frac {\int (\cos (c+d x) a+a) (a (3 A+2 C)+a (3 B-C) \cos (c+d x))dx}{3 a}+\frac {C \sin (c+d x) (a \cos (c+d x)+a)^2}{3 a d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\int \left (\sin \left (c+d x+\frac {\pi }{2}\right ) a+a\right ) \left (a (3 A+2 C)+a (3 B-C) \sin \left (c+d x+\frac {\pi }{2}\right )\right )dx}{3 a}+\frac {C \sin (c+d x) (a \cos (c+d x)+a)^2}{3 a d}\) |
\(\Big \downarrow \) 3213 |
\(\displaystyle \frac {\frac {a^2 (3 A+3 B+C) \sin (c+d x)}{d}+\frac {3}{2} a^2 x (2 A+B+C)+\frac {a^2 (3 B-C) \sin (c+d x) \cos (c+d x)}{2 d}}{3 a}+\frac {C \sin (c+d x) (a \cos (c+d x)+a)^2}{3 a d}\) |
(C*(a + a*Cos[c + d*x])^2*Sin[c + d*x])/(3*a*d) + ((3*a^2*(2*A + B + C)*x) /2 + (a^2*(3*A + 3*B + C)*Sin[c + d*x])/d + (a^2*(3*B - C)*Cos[c + d*x]*Si n[c + d*x])/(2*d))/(3*a)
3.4.3.3.1 Defintions of rubi rules used
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.) *(x_)]), x_Symbol] :> Simp[(2*a*c + b*d)*(x/2), x] + (-Simp[(b*c + a*d)*(Co s[e + f*x]/f), x] - Simp[b*d*Cos[e + f*x]*(Sin[e + f*x]/(2*f)), x]) /; Free Q[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*Co s[e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(b*f*(m + 2))), x] + Simp[1/(b*(m + 2)) Int[(a + b*Sin[e + f*x])^m*Simp[A*b*(m + 2) + b*C*(m + 1) + (b*B*(m + 2) - a*C)*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] && !LtQ[m, -1]
Time = 4.27 (sec) , antiderivative size = 57, normalized size of antiderivative = 0.63
method | result | size |
parallelrisch | \(\frac {\left (\frac {\left (B +C \right ) \sin \left (2 d x +2 c \right )}{4}+\frac {\sin \left (3 d x +3 c \right ) C}{12}+\left (A +B +\frac {3 C}{4}\right ) \sin \left (d x +c \right )+d x \left (A +\frac {B}{2}+\frac {C}{2}\right )\right ) a}{d}\) | \(57\) |
parts | \(a x A +\frac {\left (a A +B a \right ) \sin \left (d x +c \right )}{d}+\frac {\left (B a +a C \right ) \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {a C \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3 d}\) | \(79\) |
risch | \(a x A +\frac {a B x}{2}+\frac {a C x}{2}+\frac {\sin \left (d x +c \right ) a A}{d}+\frac {a B \sin \left (d x +c \right )}{d}+\frac {3 a C \sin \left (d x +c \right )}{4 d}+\frac {\sin \left (3 d x +3 c \right ) a C}{12 d}+\frac {\sin \left (2 d x +2 c \right ) B a}{4 d}+\frac {\sin \left (2 d x +2 c \right ) a C}{4 d}\) | \(101\) |
derivativedivides | \(\frac {\frac {a C \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+B a \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+a C \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+a A \sin \left (d x +c \right )+B a \sin \left (d x +c \right )+a A \left (d x +c \right )}{d}\) | \(102\) |
default | \(\frac {\frac {a C \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+B a \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+a C \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+a A \sin \left (d x +c \right )+B a \sin \left (d x +c \right )+a A \left (d x +c \right )}{d}\) | \(102\) |
norman | \(\frac {\frac {a \left (2 A +B +C \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {a \left (2 A +3 B +3 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {a \left (2 A +B +C \right ) x}{2}+\frac {3 a \left (2 A +B +C \right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}+\frac {3 a \left (2 A +B +C \right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}+\frac {a \left (2 A +B +C \right ) x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}+\frac {4 a \left (3 A +3 B +C \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{3}}\) | \(162\) |
(1/4*(B+C)*sin(2*d*x+2*c)+1/12*sin(3*d*x+3*c)*C+(A+B+3/4*C)*sin(d*x+c)+d*x *(A+1/2*B+1/2*C))*a/d
Time = 0.26 (sec) , antiderivative size = 62, normalized size of antiderivative = 0.68 \[ \int (a+a \cos (c+d x)) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {3 \, {\left (2 \, A + B + C\right )} a d x + {\left (2 \, C a \cos \left (d x + c\right )^{2} + 3 \, {\left (B + C\right )} a \cos \left (d x + c\right ) + 2 \, {\left (3 \, A + 3 \, B + 2 \, C\right )} a\right )} \sin \left (d x + c\right )}{6 \, d} \]
1/6*(3*(2*A + B + C)*a*d*x + (2*C*a*cos(d*x + c)^2 + 3*(B + C)*a*cos(d*x + c) + 2*(3*A + 3*B + 2*C)*a)*sin(d*x + c))/d
Leaf count of result is larger than twice the leaf count of optimal. 189 vs. \(2 (80) = 160\).
Time = 0.12 (sec) , antiderivative size = 189, normalized size of antiderivative = 2.08 \[ \int (a+a \cos (c+d x)) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\begin {cases} A a x + \frac {A a \sin {\left (c + d x \right )}}{d} + \frac {B a x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {B a x \cos ^{2}{\left (c + d x \right )}}{2} + \frac {B a \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d} + \frac {B a \sin {\left (c + d x \right )}}{d} + \frac {C a x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {C a x \cos ^{2}{\left (c + d x \right )}}{2} + \frac {2 C a \sin ^{3}{\left (c + d x \right )}}{3 d} + \frac {C a \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} + \frac {C a \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d} & \text {for}\: d \neq 0 \\x \left (a \cos {\left (c \right )} + a\right ) \left (A + B \cos {\left (c \right )} + C \cos ^{2}{\left (c \right )}\right ) & \text {otherwise} \end {cases} \]
Piecewise((A*a*x + A*a*sin(c + d*x)/d + B*a*x*sin(c + d*x)**2/2 + B*a*x*co s(c + d*x)**2/2 + B*a*sin(c + d*x)*cos(c + d*x)/(2*d) + B*a*sin(c + d*x)/d + C*a*x*sin(c + d*x)**2/2 + C*a*x*cos(c + d*x)**2/2 + 2*C*a*sin(c + d*x)* *3/(3*d) + C*a*sin(c + d*x)*cos(c + d*x)**2/d + C*a*sin(c + d*x)*cos(c + d *x)/(2*d), Ne(d, 0)), (x*(a*cos(c) + a)*(A + B*cos(c) + C*cos(c)**2), True ))
Time = 0.21 (sec) , antiderivative size = 98, normalized size of antiderivative = 1.08 \[ \int (a+a \cos (c+d x)) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {12 \, {\left (d x + c\right )} A a + 3 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} B a - 4 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} C a + 3 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} C a + 12 \, A a \sin \left (d x + c\right ) + 12 \, B a \sin \left (d x + c\right )}{12 \, d} \]
1/12*(12*(d*x + c)*A*a + 3*(2*d*x + 2*c + sin(2*d*x + 2*c))*B*a - 4*(sin(d *x + c)^3 - 3*sin(d*x + c))*C*a + 3*(2*d*x + 2*c + sin(2*d*x + 2*c))*C*a + 12*A*a*sin(d*x + c) + 12*B*a*sin(d*x + c))/d
Time = 0.31 (sec) , antiderivative size = 76, normalized size of antiderivative = 0.84 \[ \int (a+a \cos (c+d x)) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {1}{2} \, {\left (2 \, A a + B a + C a\right )} x + \frac {C a \sin \left (3 \, d x + 3 \, c\right )}{12 \, d} + \frac {{\left (B a + C a\right )} \sin \left (2 \, d x + 2 \, c\right )}{4 \, d} + \frac {{\left (4 \, A a + 4 \, B a + 3 \, C a\right )} \sin \left (d x + c\right )}{4 \, d} \]
1/2*(2*A*a + B*a + C*a)*x + 1/12*C*a*sin(3*d*x + 3*c)/d + 1/4*(B*a + C*a)* sin(2*d*x + 2*c)/d + 1/4*(4*A*a + 4*B*a + 3*C*a)*sin(d*x + c)/d
Time = 1.27 (sec) , antiderivative size = 100, normalized size of antiderivative = 1.10 \[ \int (a+a \cos (c+d x)) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=A\,a\,x+\frac {B\,a\,x}{2}+\frac {C\,a\,x}{2}+\frac {A\,a\,\sin \left (c+d\,x\right )}{d}+\frac {B\,a\,\sin \left (c+d\,x\right )}{d}+\frac {3\,C\,a\,\sin \left (c+d\,x\right )}{4\,d}+\frac {B\,a\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}+\frac {C\,a\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}+\frac {C\,a\,\sin \left (3\,c+3\,d\,x\right )}{12\,d} \]